package com.scommunity.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 反馈表
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "sc_feedback")
public class Feedback implements Serializable{
    private static final long serialVersionUID = 1L;
    @TableId(type = IdType.ASSIGN_ID)
    private Long fbId;
    private String fbContent;
    private String fbType;
    private Long ownerId;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime fbTime;
    private String fbStatus;
    @TableField(exist = false)
    private Owner owner;
    
    public Feedback(Feedback feedback) {
        if (Objects.nonNull(feedback)) {
            this.fbId=feedback.fbId;
            this.fbContent=feedback.fbContent;
            this.fbType=feedback.fbType;
            this.ownerId=feedback.ownerId;
            this.fbTime=feedback.fbTime;
            this.fbStatus=feedback.fbStatus;
            this.owner = feedback.owner;
        }
    }
}
